package demo.services.impl;

import demo.services.IQueryService;
import framework.annotation.InchService;
import lombok.extern.slf4j.Slf4j;

import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 * implement class for query service
 */
@InchService
@Slf4j
public class QueryService implements IQueryService {

    @Override
    public String query(String name) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String time = simpleDateFormat.format(Calendar.getInstance().getTime());
        String jsonOutput = "{name:\"" + name + "\",time:+\"" + time + "\"}";
        log.info("Form query transaction:\t" + jsonOutput);
        return jsonOutput;
    }
}
